import 'package:flutter/material.dart';
import 'package:points24/utils/random.dart';

class GameHelper {

  static List<Map<String, dynamic>> createInitDate(rawNo, {List<int>? newRawNo}) {

    var data = <Map<String, dynamic>>[];

    if (null == newRawNo) {
      data.add(Map.of({"no": RandTool.getRandom(), "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
      data.add(Map.of({"no": RandTool.getRandom(), "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
      data.add(Map.of({"no": RandTool.getRandom(), "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
      data.add(Map.of({"no": RandTool.getRandom(), "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
    } else {
      data.add(Map.of({"no": newRawNo[0], "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
      data.add(Map.of({"no": newRawNo[1], "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
      data.add(Map.of({"no": newRawNo[2], "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
      data.add(Map.of({"no": newRawNo[3], "key": UniqueKey(), "color": Colors.amberAccent, "done": false}));
    }


    for (var map in data) {
      rawNo.add(map['no']);
    }

    return data;
  }
}
